#ifndef IEDITOR_H
#define IEDITOR_H

#include "IContext.h"

namespace CodeEdit {

class IFile;

class IEditor : public IContext
{
    Q_OBJECT

public:
    IEditor(QObject *parent = 0) : IContext(parent) { }
    virtual ~IEditor() { }

    virtual bool createNew(const QString &contents = QString()) = 0;
    virtual bool open(const QString &fileName = QString()) = 0;
    virtual IFile *file() = 0;
    virtual QString id() const = 0;
    virtual QString displayName() const = 0;
    virtual void setDisplayName(const QString &title) = 0;

    virtual bool duplicateSupported() const = 0;
    virtual IEditor *duplicate(QWidget *parent) = 0;

    virtual QByteArray saveState() const = 0;
    virtual bool restoreState(const QByteArray &state) = 0;

    virtual int currentLine() const { return 0; }
    virtual int currentColumn() const { return 0; }

    virtual bool isTemporary() const = 0;

    virtual QWidget *toolBar() = 0;

    virtual QString preferredMode() const { return QString(); }

signals:
    void changed();
};

} // namespace CodeEdit

#endif // IEDITOR_H
